Field of the Invention
The present invention relates to a technique of detecting an object from a moving image.
Description of the Related Art
As a technique of detecting an object from an image shot by a camera, a background subtraction method is disclosed. In the background subtraction method, a background image without any object is shot by a fixed camera in advance, and the feature of the image is stored as a background model. After that, the difference between the feature in the background model and the feature in an image input from the camera is obtained, and a different region is detected as a foreground (object).
For example, in patent literature 1 (Japanese Patent No. 2950267), a background model is generated using pixel values as features, and the difference is calculated on a pixel basis, thereby detecting an object. When the background model is generated on a pixel basis, the memory consumption and the processing cost increase as the resolution rises. To prevent this, in patent literature 2 (Japanese Patent No. 4653155), an input image is divided into 8×8 pixel blocks, and DCT (Discrete Cosine Transform) coefficients as a result of encoding by DCT are used as features.
In the background subtraction method, however, since the camera is assumed to be fixed, the following problems arise if the camera moves due to vibration or the like. That is, if an input image is shifted by the motion of the camera even without any object in the image, image contents at the same coordinates change between input images that temporally continue in the method of patent literature 1. For example, in pixels near the boundary between a red door and a blue wall, the pixel values abruptly change from red to blue. Additionally, in a block including the boundary between the red door and the blue wall, the ratio of red and blue pixels included in the block changes in the method of patent literature 2. As a result, a detection error occurs near a boundary including strong edges in the background in both the method of patent literature 1 and the method of patent literature 2.
In the method of patent literature 1, since the coordinates of pixels of the same pixel value only shift, the detection error can be prevented by adding neighboring pixels to the comparison target. However, this method cannot solve the problems of the memory capacity and the processing cost. The method of patent literature 2 can suppress the memory capacity and the processing cost. However, since the feature of the block itself changes, the problem of the detection error cannot be solved. Hence, the conventional techniques cannot avoid a detection error that occurs due to the shift of an input image caused by the motion of the camera without increasing the memory consumption and the processing cost.